﻿<UserControl x:Class="Supremacy.Client.Views.ColonyShipyardBuildQueueView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:s="http://schemas.startreksupremacy.com/xaml/core"
             xmlns:scc="http://schemas.startreksupremacy.com/xaml/presentation">
  <UserControl.Resources>
    <DataTemplate x:Key="ShipyardBuildSlotTemplate"
              DataType="{x:Type s:BuildSlot}">
      <Border>
        <Grid TextBlock.Foreground="{StaticResource {x:Static scc:ClientResources.DefaultTextForegroundBrushKey}}"
              TextBlock.FontSize="14pt"
              Margin="0,7,0,7">
          <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="Auto" />
          </Grid.ColumnDefinitions>
          <Border x:Name="ImageBorder"
                  Grid.Column="0"
                  BorderBrush="White"
                  BorderThickness="2"
                  CornerRadius="4"
                  Width="58"
                  Height="48">
            <Border.Background>
              <ImageBrush Stretch="UniformToFill"
                          ImageSource="{Binding Path=Project.BuildDesign.Image, Converter={StaticResource TechObjectImageConverter}}" />
            </Border.Background>
          </Border>
          <TextBlock Grid.Column="1"
                     VerticalAlignment="Center"
                     FontFamily="{StaticResource {x:Static scc:ClientResources.HeaderFontFamilyKey}}"
                     FontSize="14pt"
                     Margin="7,0,0,0">
            <TextBlock x:Name="DescriptionText"
                       Foreground="{StaticResource {x:Static scc:ClientResources.HeaderTextForegroundBrushKey}}"
                       Text="{Binding Path=Project.Description, Converter={StaticResource UpperCaseConverter}}" />
            <LineBreak />
            <TextBlock x:Name="ProgressText"
                       Foreground="{StaticResource {x:Static scc:ClientResources.DefaultTextForegroundBrushKey}}">
              <TextBlock Text="{Binding Path=Project.PercentComplete}" />
              <TextBlock Text="/" />
              <TextBlock x:Name="StatusText">
                <TextBlock Text="{Binding Path=Project.TurnsRemaining}" />
                <TextBlock x:Name="TurnsText"
                           Text="{s:StringResource Key=BUILD_QUEUE_TURNS_REMAINING, Case=Upper}" />
              </TextBlock>
              <TextBlock x:Name="OnHoldText"
                         Text="{s:StringResource Key=PROJECT_ON_HOLD, Case=Upper}"
                         Visibility="Collapsed" />
              <TextBlock x:Name="ShipyardOfflineText"
                         Foreground="Red"
                         Text="{s:StringResource Key=SHIPYARD_OFFLINE, Case=Upper}"
                         Visibility="Collapsed" />
            </TextBlock>
          </TextBlock>
          <Grid x:Name="ResourceGrid"
                Grid.Column="3"
                VerticalAlignment="Center">
            <Grid.ColumnDefinitions>
              <ColumnDefinition Width="45" />
              <ColumnDefinition Width="Auto" />
              <ColumnDefinition Width="45" />
              <ColumnDefinition Width="Auto" />
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
              <RowDefinition Height="24" />
              <RowDefinition Height="24" />
            </Grid.RowDefinitions>
            <Image Grid.Column="0"
                   Grid.Row="0"
                   Width="24"
                   Height="24"
                   Margin="14,0,7,0"
                   ToolTip="{s:StringResource DILITHIUM}">
              <Image.Source>
                <BitmapImage UriSource="vfs:///Resources/Images/Resources/dilithium.png" />
              </Image.Source>
            </Image>
            <TextBlock Grid.Column="1"
                       Grid.Row="0">
              <TextBlock Text="{Binding Path=Project.DilithiumUsed}" />
              <TextBlock Text="/" />
              <TextBlock Text="{Binding Path=Project.DilithiumNeeded}" />
            </TextBlock>
            <Image Grid.Column="0"
                   Grid.Row="1"
                   Width="24"
                   Height="24"
                   Margin="14,0,7,0"
                   ToolTip="{s:StringResource DEUTERIUM}">
              <Image.Source>
                <BitmapImage UriSource="vfs:///Resources/Images/Resources/deuterium.png" />
              </Image.Source>
            </Image>
            <TextBlock Grid.Column="1"
                       Grid.Row="1">
              <TextBlock Text="{Binding Path=Project.DeuteriumUsed}" />
              <TextBlock Text="/" />
              <TextBlock Text="{Binding Path=Project.DeuteriumNeeded}" />
            </TextBlock>
            <Image Grid.Column="2"
                   Grid.Row="0"
                   Width="24"
                   Height="24"
                   Margin="14,0,7,0"
                   ToolTip="{s:StringResource RAW_MATERIALS}">
              <Image.Source>
                <BitmapImage UriSource="vfs:///Resources/Images/Resources/rawmaterials.png" />
              </Image.Source>
            </Image>
            <TextBlock Grid.Column="3"
                       Grid.Row="0">
              <TextBlock Text="{Binding Path=Project.RawMaterialsUsed}" />
              <TextBlock Text="/" />
              <TextBlock Text="{Binding Path=Project.RawMaterialsNeeded}" />
            </TextBlock>
            <!--<Image Grid.Column="2"
                   Grid.Row="1"
                   Width="24"
                   Height="24"
                   Margin="14,0,7,0"
                   ToolTip="{s:StringResource OFFICERS}">
              <Image.Source>
                <BitmapImage UriSource="vfs:///Resources/Images/Resources/personnel.png" />
              </Image.Source>
            </Image>
            <TextBlock Grid.Column="3"
                       Grid.Row="1">
              <TextBlock Text="{Binding Path=Project.PersonnelUsed}" />
              <TextBlock Text="/" />
              <TextBlock Text="{Binding Path=Project.PersonnelNeeded}" />
            </TextBlock>-->
          </Grid>
        </Grid>
      </Border>
      <DataTemplate.Triggers>
        <DataTrigger Binding="{Binding Path=Project}"
                     Value="{x:Null}">
          <Setter TargetName="DescriptionText"
                  Property="Text"
                  Value="{s:StringResource Key=SHIPYARD_DOCK_AVAILABLE, Case=Upper}" />
          <Setter TargetName="ProgressText"
                  Property="Visibility"
                  Value="Hidden" />
          <Setter TargetName="ResourceGrid"
                  Property="Visibility"
                  Value="Hidden" />
        </DataTrigger>
        <DataTrigger Binding="{Binding Path=OnHold}"
                     Value="True">
          <Setter TargetName="StatusText"
                  Property="Visibility"
                  Value="Collapsed" />
          <Setter TargetName="OnHoldText"
                  Property="Visibility"
                  Value="Visible" />
        </DataTrigger>
        <DataTrigger Binding="{Binding Path=Model.SelectedColony.Shipyard.IsActive, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type scc:ColonyScreenView}}}"
                     Value="False">
          <Setter TargetName="StatusText"
                  Property="Visibility"
                  Value="Collapsed" />
          <Setter TargetName="OnHoldText"
                  Property="Visibility"
                  Value="Collapsed" />
          <Setter TargetName="ShipyardOfflineText"
                  Property="Visibility"
                  Value="Visible" />
        </DataTrigger>
      </DataTemplate.Triggers>
    </DataTemplate>
    <DataTemplate x:Key="ShipyardBuildQueueItemTemplate">
      <Border>
        <Grid TextBlock.Foreground="{StaticResource {x:Static scc:ClientResources.DefaultTextForegroundBrushKey}}"
              TextBlock.FontSize="14pt"
              Margin="0,7,0,7">
          <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="Auto" />
          </Grid.ColumnDefinitions>
          <Border x:Name="ImageBorder"
                  Grid.Column="0"
                  BorderBrush="Gray"
                  BorderThickness="2"
                  CornerRadius="4"
                  Width="58"
                  Height="48">
            <Border.Background>
              <ImageBrush Stretch="UniformToFill"
                          ImageSource="{Binding Path=Project.BuildDesign.Image, Converter={StaticResource TechObjectImageConverter}}" />
            </Border.Background>
          </Border>
          <TextBlock Grid.Column="1"
                     VerticalAlignment="Center"
                     FontFamily="{StaticResource {x:Static scc:ClientResources.HeaderFontFamilyKey}}"
                     FontSize="14pt"
                     Margin="7,0,0,0">
            <TextBlock x:Name="DescriptionText"
                       Foreground="{StaticResource {x:Static scc:ClientResources.HeaderTextForegroundBrushKey}}"
                       Text="{Binding Path=Description, Converter={StaticResource UpperCaseConverter}, ConverterParameter=UpperCase}" />
            <LineBreak />
            <TextBlock x:Name="ProgressText"
                       Foreground="{StaticResource {x:Static scc:ClientResources.DefaultTextForegroundBrushKey}}">
              <TextBlock x:Name="StatusText">
                <TextBlock Text="{Binding Path=Project.TurnsRemaining}" />
                <TextBlock x:Name="TurnsText"
                           Text="{s:StringResource Key=BUILD_QUEUE_TURNS_REMAINING, Case=Upper}" />
              </TextBlock>
            </TextBlock>
          </TextBlock>
          <Grid x:Name="ResourceGrid"
                Grid.Column="2"
                VerticalAlignment="Center">
            <Grid.ColumnDefinitions>
              <ColumnDefinition Width="45" />
              <ColumnDefinition Width="Auto" />
              <ColumnDefinition Width="45" />
              <ColumnDefinition Width="Auto" />
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
              <RowDefinition Height="24" />
              <RowDefinition Height="24" />
            </Grid.RowDefinitions>
            <Image Grid.Column="0"
                   Grid.Row="0"
                   Width="24"
                   Height="24"
                   Margin="14,0,7,0"
                   ToolTip="{s:StringResource DILITHIUM}">
              <Image.Source>
                <BitmapImage UriSource="vfs:///Resources/Images/Resources/dilithium.png" />
              </Image.Source>
            </Image>
            <TextBlock Grid.Column="1"
                       Grid.Row="0">
              <TextBlock Text="{Binding Path=Project.DilithiumUsed}" />
              <TextBlock Text="/" />
              <TextBlock Text="{Binding Path=Project.DilithiumNeeded}" />
            </TextBlock>
            <Image Grid.Column="0"
                   Grid.Row="1"
                   Width="24"
                   Height="24"
                   Margin="14,0,7,0"
                   ToolTip="{s:StringResource DEUTERIUM}">
              <Image.Source>
                <BitmapImage UriSource="vfs:///Resources/Images/Resources/deuterium.png" />
              </Image.Source>
            </Image>
            <TextBlock Grid.Column="1"
                       Grid.Row="1">
              <TextBlock Text="{Binding Path=Project.DeuteriumUsed}" />
              <TextBlock Text="/" />
              <TextBlock Text="{Binding Path=Project.DeuteriumNeeded}" />
            </TextBlock>
            <Image Grid.Column="2"
                   Grid.Row="0"
                   Width="24"
                   Height="24"
                   Margin="14,0,7,0"
                   ToolTip="{s:StringResource RAW_MATERIALS}">
              <Image.Source>
                <BitmapImage UriSource="vfs:///Resources/Images/Resources/rawmaterials.png" />
              </Image.Source>
            </Image>
            <TextBlock Grid.Column="3"
                       Grid.Row="0">
              <TextBlock Text="{Binding Path=Project.RawMaterialsUsed}" />
              <TextBlock Text="/" />
              <TextBlock Text="{Binding Path=Project.RawMaterialsNeeded}" />
            </TextBlock>
            <!--<Image Grid.Column="2"
                   Grid.Row="1"
                   Width="24"
                   Height="24"
                   Margin="14,0,7,0"
                   ToolTip="{s:StringResource OFFICERS}">
              <Image.Source>
                <BitmapImage UriSource="vfs:///Resources/Images/Resources/personnel.png" />
              </Image.Source>
            </Image>
            <TextBlock Grid.Column="3"
                       Grid.Row="1">
              <TextBlock Text="{Binding Path=Project.PersonnelUsed}" />
              <TextBlock Text="/" />
              <TextBlock Text="{Binding Path=Project.PersonnelNeeded}" />
            </TextBlock>-->
          </Grid>
        </Grid>
      </Border>
    </DataTemplate>
  </UserControl.Resources>
  <DockPanel>
    <s:HoverItemsControl x:Name="BuildSlotList"
                         DockPanel.Dock="Top"
                         ItemsSource="{Binding Path=SelectedColony.Shipyard.BuildSlots, Mode=OneWay}"
                         ItemClicked="OnBuildSlotListItemClicked"
                         Background="Transparent"
                         ItemTemplate="{StaticResource ShipyardBuildSlotTemplate}" />
    <s:HoverItemsControl x:Name="BuildQueue"
                         DockPanel.Dock="Top"
                         Grid.Row="1"
                         ItemsSource="{Binding Path=SelectedColony.Shipyard.BuildQueue, Mode=OneWay}"
                         ItemClicked="OnBuildQueueItemClicked"
                         Background="Transparent"
                         ItemTemplate="{StaticResource ShipyardBuildQueueItemTemplate}" />
  </DockPanel>
</UserControl>
